﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Framework.UI.Controls"
                    xmlns:params="http://schemas.codeplex.com/elysium/params">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium;component/Themes/Generic.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type controls:MessageDialog}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:MessageDialog}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <ContentControl Grid.RowSpan="2" 
                                        Content="{TemplateBinding Icon}"
                                        ContentTemplate="{TemplateBinding IconTemplate}"
                                        ContentTemplateSelector="{TemplateBinding IconTemplateSelector}"
                                        Focusable="False"
                                        Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type controls:OverlayWindow}}}"
                                        Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Top', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>

                        <ContentControl Grid.Column="1"  
                                        Content="{TemplateBinding Header}"
                                        ContentTemplate="{TemplateBinding HeaderTemplate}"
                                        ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                        Focusable="False"
                                        Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type controls:OverlayWindow}}}"
                                        Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Top, Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>

                        <ContentControl Grid.Column="1"  
                                        Grid.Row="1" 
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                        ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                        Focusable="False"
                                        Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type controls:OverlayWindow}}}"
                                        Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Top, Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>

                        <ListBox x:Name="PART_Buttons" 
                                 Grid.ColumnSpan="2" 
                                 Grid.Row="2" 
                                 Background="{StaticResource TransparentBrush}"
                                 BorderBrush="{StaticResource TransparentBrush}"
                                 BorderThickness="0"
                                 ItemsSource="{Binding Path=Items, RelativeSource={RelativeSource TemplatedParent}}">
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="{x:Type ListBoxItem}">
                                    <Setter Property="Focusable" Value="False"/>
                                </Style>
                            </ListBox.ItemContainerStyle>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Button Command="{Binding Command}"
                                            CommandParameter="{Binding CommandParameter}"
                                            Content="{Binding Content}"
                                            ContentTemplate="{Binding ContentTemplate}"
                                            Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Top, Bottom', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Horizontal"/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                        </ListBox>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>